<%
	def transcations = request.transcations
	if(transcations?.size() > 0) {
%>
<table id="sortTable" width="100%" border="0" cellpadding="4" cellspacing="0" align="center">
<thead>	
<tr class="table-2-header">
	<td class="table-2-cell" align="right" width="30">&nbsp;</td>
	<th class="table-2-cell" align="right" width="30">Id</th>
	<th class="table-2-cell" align="right" width="70">Amount</th>
	<th class="table-2-cell" align="left">Description</th>
	<th class="table-2-cell" align="left">Tags</th>
	<th class="table-2-cell" align="left">Date & Time</th>
</tr>
	</thead>
<tbody>	
<%
use(groovy.time.TimeCategory) {
	int timeZoneHour = session.userTimeZoneHour as int
	int timeZoneMinute = session.userTimeZoneMinute as int
	
	def transcationTags = request.transcationTags
	int i = 0;
	transcations.each { transcation ->
		i++;
		String s = i % 2 == 0 ? 'table-2-even-row' : 'table-2-odd-row'
		def transcationTag = transcationTags[transcation.key.id]
		def amount = String.format("%.2f", transcation.amount)
		def time = transcation.createdTime + timeZoneHour.hours + timeZoneMinute.minutes
		def createdTime = time.format('dd-MM-yyyy HH:mm:ss')
%>						
<tr class="${s}">
	<td class="table-2-cell" align="right">$i</td>						
	<td class="table-2-cell" align="right">
		<a class="table-2-link" href="transcationEdit.groovy?transcationKey=${transcation.key.id}">$transcation.key.id</a>
	</td>
	<td class="table-2-cell" align="right">$amount</td>
	<td class="table-2-cell">$transcation.description</td>
	<td class="table-2-cell">$transcationTag</td>
	<td class="table-2-cell">$createdTime </td>
</tr>
<%
	}
}
%>
</tbody>
</table>
<%	}	%>
<br/>
